/*
 * Copyright 2011 Romain Gilles
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jvdb;

import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.Ref;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Map;

/**
 * @author Romain Gilles
 */
public class CallableStatementWrapper extends PreparedStatementWrapper implements CallableStatement {

    private final CallableStatement delegate;

    CallableStatementWrapper(SimpleConnectionWrapper parent, CallableStatement delegate, String sql, int statementId, IPreparedStatementTimer timer) {
        super(parent, delegate, sql, statementId, timer);
        this.delegate = delegate;
    }

    static CallableStatementWrapper newCallableStatementWrapper(SimpleConnectionWrapper parent, CallableStatement delegate, String sql, int statementId, IPreparedStatementTimer timer) {
        return new CallableStatementWrapper(parent, delegate, sql, statementId, timer);
    }

    public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException {
        delegate.registerOutParameter(parameterIndex, sqlType);
    }

    public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException {
        delegate.registerOutParameter(parameterIndex, sqlType, scale);
    }

    public boolean wasNull() throws SQLException {
        return delegate.wasNull();
    }

    public String getString(int parameterIndex) throws SQLException {
        return delegate.getString(parameterIndex);
    }

    public boolean getBoolean(int parameterIndex) throws SQLException {
        return delegate.getBoolean(parameterIndex);
    }

    public byte getByte(int parameterIndex) throws SQLException {
        return delegate.getByte(parameterIndex);
    }

    public short getShort(int parameterIndex) throws SQLException {
        return delegate.getShort(parameterIndex);
    }

    public int getInt(int parameterIndex) throws SQLException {
        return delegate.getInt(parameterIndex);
    }

    public long getLong(int parameterIndex) throws SQLException {
        return delegate.getLong(parameterIndex);
    }

    public float getFloat(int parameterIndex) throws SQLException {
        return delegate.getFloat(parameterIndex);
    }

    public double getDouble(int parameterIndex) throws SQLException {
        return delegate.getDouble(parameterIndex);
    }

    @Deprecated
    public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException {
        return delegate.getBigDecimal(parameterIndex, scale);
    }

    public byte[] getBytes(int parameterIndex) throws SQLException {
        return delegate.getBytes(parameterIndex);
    }

    public Date getDate(int parameterIndex) throws SQLException {
        return delegate.getDate(parameterIndex);
    }

    public Time getTime(int parameterIndex) throws SQLException {
        return delegate.getTime(parameterIndex);
    }

    public Timestamp getTimestamp(int parameterIndex) throws SQLException {
        return delegate.getTimestamp(parameterIndex);
    }

    public Object getObject(int parameterIndex) throws SQLException {
        return delegate.getObject(parameterIndex);
    }

    public BigDecimal getBigDecimal(int parameterIndex) throws SQLException {
        return delegate.getBigDecimal(parameterIndex);
    }

    public Object getObject(int i, Map<String, Class<?>> map) throws SQLException {
        return delegate.getObject(i, map);
    }

    public Ref getRef(int i) throws SQLException {
        return delegate.getRef(i);
    }

    public Blob getBlob(int i) throws SQLException {
        return delegate.getBlob(i);
    }

    public Clob getClob(int i) throws SQLException {
        return delegate.getClob(i);
    }

    public Array getArray(int i) throws SQLException {
        return delegate.getArray(i);
    }

    public Date getDate(int parameterIndex, Calendar cal) throws SQLException {
        return delegate.getDate(parameterIndex, cal);
    }

    public Time getTime(int parameterIndex, Calendar cal) throws SQLException {
        return delegate.getTime(parameterIndex, cal);
    }

    public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException {
        return delegate.getTimestamp(parameterIndex, cal);
    }

    public void registerOutParameter(int paramIndex, int sqlType, String typeName) throws SQLException {
        delegate.registerOutParameter(paramIndex, sqlType, typeName);
    }

    public void registerOutParameter(String parameterName, int sqlType) throws SQLException {
        delegate.registerOutParameter(parameterName, sqlType);
    }

    public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException {
        delegate.registerOutParameter(parameterName, sqlType, scale);
    }

    public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException {
        delegate.registerOutParameter(parameterName, sqlType, typeName);
    }

    public URL getURL(int parameterIndex) throws SQLException {
        return delegate.getURL(parameterIndex);
    }

    public void setURL(String parameterName, URL val) throws SQLException {
        delegate.setURL(parameterName, val);
    }

    public void setNull(String parameterName, int sqlType) throws SQLException {
        delegate.setNull(parameterName, sqlType);
    }

    public void setBoolean(String parameterName, boolean x) throws SQLException {
        delegate.setBoolean(parameterName, x);
    }

    public void setByte(String parameterName, byte x) throws SQLException {
        delegate.setByte(parameterName, x);
    }

    public void setShort(String parameterName, short x) throws SQLException {
        delegate.setShort(parameterName, x);
    }

    public void setInt(String parameterName, int x) throws SQLException {
        delegate.setInt(parameterName, x);
    }

    public void setLong(String parameterName, long x) throws SQLException {
        delegate.setLong(parameterName, x);
    }

    public void setFloat(String parameterName, float x) throws SQLException {
        delegate.setFloat(parameterName, x);
    }

    public void setDouble(String parameterName, double x) throws SQLException {
        delegate.setDouble(parameterName, x);
    }

    public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException {
        delegate.setBigDecimal(parameterName, x);
    }

    public void setString(String parameterName, String x) throws SQLException {
        delegate.setString(parameterName, x);
    }

    public void setBytes(String parameterName, byte[] x) throws SQLException {
        delegate.setBytes(parameterName, x);
    }

    public void setDate(String parameterName, Date x) throws SQLException {
        delegate.setDate(parameterName, x);
    }

    public void setTime(String parameterName, Time x) throws SQLException {
        delegate.setTime(parameterName, x);
    }

    public void setTimestamp(String parameterName, Timestamp x) throws SQLException {
        delegate.setTimestamp(parameterName, x);
    }

    public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException {
        delegate.setAsciiStream(parameterName, x, length);
    }

    public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException {
        delegate.setBinaryStream(parameterName, x, length);
    }

    public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException {
        delegate.setObject(parameterName, x, targetSqlType, scale);
    }

    public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException {
        delegate.setObject(parameterName, x, targetSqlType);
    }

    public void setObject(String parameterName, Object x) throws SQLException {
        delegate.setObject(parameterName, x);
    }

    public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException {
        delegate.setCharacterStream(parameterName, reader, length);
    }

    public void setDate(String parameterName, Date x, Calendar cal) throws SQLException {
        delegate.setDate(parameterName, x, cal);
    }

    public void setTime(String parameterName, Time x, Calendar cal) throws SQLException {
        delegate.setTime(parameterName, x, cal);
    }

    public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException {
        delegate.setTimestamp(parameterName, x, cal);
    }

    public void setNull(String parameterName, int sqlType, String typeName) throws SQLException {
        delegate.setNull(parameterName, sqlType, typeName);
    }

    public String getString(String parameterName) throws SQLException {
        return delegate.getString(parameterName);
    }

    public boolean getBoolean(String parameterName) throws SQLException {
        return delegate.getBoolean(parameterName);
    }

    public byte getByte(String parameterName) throws SQLException {
        return delegate.getByte(parameterName);
    }

    public short getShort(String parameterName) throws SQLException {
        return delegate.getShort(parameterName);
    }

    public int getInt(String parameterName) throws SQLException {
        return delegate.getInt(parameterName);
    }

    public long getLong(String parameterName) throws SQLException {
        return delegate.getLong(parameterName);
    }

    public float getFloat(String parameterName) throws SQLException {
        return delegate.getFloat(parameterName);
    }

    public double getDouble(String parameterName) throws SQLException {
        return delegate.getDouble(parameterName);
    }

    public byte[] getBytes(String parameterName) throws SQLException {
        return delegate.getBytes(parameterName);
    }

    public Date getDate(String parameterName) throws SQLException {
        return delegate.getDate(parameterName);
    }

    public Time getTime(String parameterName) throws SQLException {
        return delegate.getTime(parameterName);
    }

    public Timestamp getTimestamp(String parameterName) throws SQLException {
        return delegate.getTimestamp(parameterName);
    }

    public Object getObject(String parameterName) throws SQLException {
        return delegate.getObject(parameterName);
    }

    public BigDecimal getBigDecimal(String parameterName) throws SQLException {
        return delegate.getBigDecimal(parameterName);
    }

    public Object getObject(String parameterName, Map<String, Class<?>> map) throws SQLException {
        return delegate.getObject(parameterName, map);
    }

    public Ref getRef(String parameterName) throws SQLException {
        return delegate.getRef(parameterName);
    }

    public Blob getBlob(String parameterName) throws SQLException {
        return delegate.getBlob(parameterName);
    }

    public Clob getClob(String parameterName) throws SQLException {
        return delegate.getClob(parameterName);
    }

    public Array getArray(String parameterName) throws SQLException {
        return delegate.getArray(parameterName);
    }

    public Date getDate(String parameterName, Calendar cal) throws SQLException {
        return delegate.getDate(parameterName, cal);
    }

    public Time getTime(String parameterName, Calendar cal) throws SQLException {
        return delegate.getTime(parameterName, cal);
    }

    public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException {
        return delegate.getTimestamp(parameterName, cal);
    }

    public URL getURL(String parameterName) throws SQLException {
        return delegate.getURL(parameterName);
    }
}
